package offer;

public class Solution56_I {
    public int[] singleNumbers(int[] nums) {
        int a = 0;
        for (int num : nums) {
            a ^= num;
        }
        int t = 1;
        while ((t & a) == 0) {
            t <<= 1;
        }
        int b = 0;
        a = 0;
        for (int num : nums) {
            if ((num & t) == 0) {
                a ^= num;
            } else {
                b ^= num;
            }
        }
        return new int[]{a, b};
    }
}
